<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="com.fc.util.*" %>
<%@ page import="com.fc.model.Admin" %>
<%@ page import="com.fc.control.AdminControl" %>
<%@ include file="../login/login_check.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>admin_update_do</title>
</head>
<body>
<%
     request.setCharacterEncoding("UTF-8");
     int id=ParamUtil.getInt(request,"id",0);
     String user_name=ParamUtil.getString(request,"user_name");
     String user_pwd2=ParamUtil.getString(request,"user_pwd2");
  	 String user_pwd3=ParamUtil.getString(request,"user_pwd3");
  	 String phone=ParamUtil.getString(request,"phone");
  	 //AdminControl ac = new AdminControl();
     Admin admin = new Admin();
     admin.setUsername(user_name);
	 admin.setPassword(user_pwd2);
	 admin.setPhone(phone);
	 if(user_pwd2.equals(user_pwd3))
	 {
		if(AdminControl.updateAdmin(admin,user_name))
		{
  				%>
		<script language="javascript">
  				alert("修改成功");
  				window.location.href="admin.jsp";
  				</script>
		<%} else { %>
		<script language="javascript">
  				alert("修改失败");
  				history.back(-1);
  				</script>
		<%} 
  		}
  		else 
  		{%>
		<script language="javascript">
  			alert("密码错误或密码不一致");
  	        history.back();
  			</script>
		<%}
  %>
</body>
</html>